<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/echarts.min.js"></script>
		<script src="js/jquery-3.4.0.min.js"></script>
	</head>
	<body>
		<!-- 每周信息 -->
		<div id="weekInfo" style="width: 600px;height: 400px;"></div>
		<script type="text/javascript">
			var chartDom0 = document.getElementById('weekInfo');
			var myChart0 = echarts.init(chartDom0);
			// myChar.showLoading();
			myIp = {
				"userid": 0
			}
			$.ajax({
				type: "put",
				url: "http://localhost:8080/myIp/getWeekInfo",
				contentType: "application/json;charset=utf-8",
				data: JSON.stringify(myIp),
				dataType: "json",
				success: function(res) {
					var day = new Array()
					var coun = new Array()
					for (let s of res) {
						day.push(s.myDay)
						coun.push(s.count)
					}
					console.log(day)
					console.log(coun)
					console.log(res[0].myDay);
					if (res) {
						myChart0.hideLoading()
						myChart0.setOption({
							xAxis: {
								type: 'category',
								data: day
							},
							yAxis: {
								type: 'value'
							},
							series: [{
								data: coun,
								type: 'line'
							}]
						});
					}
				}
			})
		</script>
		<!-- 时间段内前10ip -->
		<div id="rankInfo" style="width: 600px;height: 400px;"></div>
		<script type="text/javascript">
			var chartDom1 = document.getElementById('rankInfo');
			var myChart1 = echarts.init(chartDom1);
			var option;
			myIp = {
				"userid": 0
			}
			$.ajax({
				type: "put",
				url: "http://localhost:8080/myIp/getRankInfo",
				contentType: "application/json;charset=utf-8",
				data: JSON.stringify(myIp),
				dataType: "json",
				success: function(res) {
					var ip = new Array()
					var aCount = new Array()
					for (let s of res) {
						ip.push(s.ip)
						aCount.push(s.aCount)
					}
					myChart1.hideLoading()
					myChart1.setOption({
						xAxis: {
							type: 'category',
							data: ip
						},
						yAxis: {
							type: 'value'
						},
						series: [{
							data: aCount,
							type: 'bar'
						}]
					});
				}
				
			})
		</script>
		<!-- 饼状图select语句不太会 -->
	</body>
</html>
